import { NgModule } from '@angular/core'
import { Routes, RouterModule } from '@angular/router'
import { NewRouterGuardClass } from '@shared/classes/NewRouterGuardClass'
import { ListComponent } from './list/list.component'
import { DetailComponent } from './detail/detail.component'
import { TabRulesComponent } from './detail/tab-rules/tab-rules.component'
import { TabMccComponent } from './detail/tab-mcc/tab-mcc.component'
import { TabRangeComponent } from './detail/tab-range/tab-range.component'
import { NewComponent } from './new/new.component'
import { ListReuseGuardClass } from '@shared/classes/ListReuseGuardClass'
const routes: Routes = [
  { path: '', redirectTo: 'list', pathMatch: 'full' },
  {
    path: 'list',
    component: ListComponent,
    canActivate: [ListReuseGuardClass],
    data: {
      title: '事后风控列表',
      titleI18n: '',
      reuse: true,
    },
  },
  {
    path: ':id',
    component: DetailComponent,
    children: [
      { path: '', redirectTo: 'rules', pathMatch: 'full' },
      {
        path: 'rules',
        component: TabRulesComponent,
        data: {
          titleI18n: 'RISK_CTRL.TITLE.DETAIL',
        },
      },
      {
        path: 'range',
        component: TabRangeComponent,
        data: {
          titleI18n: 'RISK_CTRL.TITLE.DETAIL',
        },
      },
      {
        path: 'merchant',
        component: TabMccComponent,
        data: {
          titleI18n: 'RISK_CTRL.TITLE.DETAIL',
        },
      },
    ],
    data: {
      breadcrumb: 'GENERAL.INFO.BREADCRUMB.DETAIL',
      titleI18n: 'RISK_CTRL.TITLE.DETAIL',
    },
  },
  {
    path: 'creatRiskScheme/new',
    component: NewComponent,
    canDeactivate: [NewRouterGuardClass],
    data: {
      breadcrumb: 'GENERAL.INFO.BREADCRUMB.CREATE',
      titleI18n: 'RISK_CTRL.TITLE.CREATE',
    },
  },
  {
    path: 'creatRiskScheme/update',
    component: NewComponent,
    canDeactivate: [NewRouterGuardClass],
    data: {
      breadcrumb: 'BTN.EDIT',
      titleI18n: 'RISK_CTRL.TITLE.UPDATE',
    },
  },
]

@NgModule({
  imports: [RouterModule.forChild(routes)],
  exports: [RouterModule],
})
export class PostRiskRoutingModule {}
